Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add e2e tests #9

Merged
merged 3 commits into from
Jun 9, 2021
Merged

add e2e tests #9

merged 3 commits into from
Jun 9, 2021

Conversation

veezhang
Copy link
Contributor

No description provided.

@veezhang veezhang requested a review from MegaByte875 May 13, 2021 11:16
@veezhang veezhang added type/feature req Type: feature request ready-for-testing Progress: ready for the CI test and removed ready-for-testing Progress: ready for the CI test labels May 13, 2021
@veezhang veezhang mentioned this pull request May 14, 2021
MegaByte875
MegaByte875 previously approved these changes May 30, 2021
hack/e2e.sh Outdated

ginkgo ./tests/e2e \
-- \
--install-kubernetes=${INSTALL_KUBERNETES} \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SC2086 Double quote to prevent globbing and word splitting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goland shell scripts plugins

hack/e2e.sh Outdated
KIND_NAME=${KIND_NAME:-e2e-test}
KIND_CONFIG=${KIND_CONFIG:-${ROOT}/hack/kind-config.yaml}

KUBECONFIG=${KUBECONFIG:-~/.kube/${KIND_NAME}.kind.config}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I didn't use kind cluster, the KUBECONFIG is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you will be able to use the existing kubernetes via the following command:

INSTALL_KUBERNETES=false make e2e


func getNebulaCluster(namespace, name string) *v1alpha1.NebulaCluster {
imagePullPolicy := corev1.PullIfNotPresent
storageClassName := "standard" // standard, fast-disks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be configurable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following priority will be applied:

  1. STORAGE_CLASS environment variable
  2. The default ClassName in kubernetes
  3. The other ClassName in kubernetes

PodSpec: v1alpha1.PodSpec{
Replicas: pointer.Int32Ptr(1),
Image: "vesoft/nebula-graphd",
Version: "v2-nightly",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the latest version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default: v2-nightly, and I'll add config for the image.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to use v2-nightly, and you can set the NEBULA_VERSION environment variable to specify the version.

NEBULA_VERSION=v2.0.1 make e2e

"--repo", "https://charts.jetstack.io",
"--namespace", helmNamespace,
"--create-namespace",
"--version", "v1.3.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be configurable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to use v1.3.1, and you can set the INSTALL_CERT_MANAGER_VERSION environment variable to specify the version.

INSTALL_CERT_MANAGER_VERSION=v1.3.1 make e2e

helmArgs := []string{
"install", helmName,
"https://github.com/openkruise/kruise/releases/download/v0.8.1/kruise-chart.tgz",
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be configurable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to use v0.8.1, and you can set the INSTALL_KRUISE_VERSION environment variable to specify the version.

INSTALL_KRUISE_VERSION=v0.8.1 make e2e

return
}
helmName := "kruise"
helmNamespace := "default"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set namespace to kruise-system

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helmNamespace means the helm's namespace nor the crd's namespace to install.

In the helm repo, there have a namespace resource kruise-system. So, if set helmNamespace to kruise-system, we need to create kruise-system first or add --create-namespce to helm command.
But it already a namespace kruise-system in helm repo.
There's a conflict. I haven't found a better way at the moment.

return true
}

func helmInstall(name, namespace string, workloadNamespaces []string, args ...string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think install helm charts [kruise,cert-manager,nebula-operator] by e2e.sh shell scripts more concise, we can check if they installed or not in e2e framework

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shell script should be executed before the test starts. And there may be different behaviors between each test case. With go, we can have better control.

"USE e2e_test;" +
"CREATE TAG IF NOT EXISTS person(name string, age int);" +
"CREATE EDGE IF NOT EXISTS like(likeness double);"
err = waitForExecuteNebulaSchema(30*time.Second, 2*time.Second, graphLocalAddress, graphLocalPort, "user", "pass", executeSchema)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we run the e2e test without creating a new kind cluster, the graphLocalAddress and graphLocalPort will not work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It dose work. And it have tested.
The network traffic forwards to api-server, and then to graphd.
We can access the api-server, so the network traffic that forward to graphd.

@veezhang veezhang force-pushed the e2e branch 6 times, most recently from 9de51f1 to fb77c6e Compare June 4, 2021 03:42
@MegaByte875
Copy link
Contributor

LGTM

@MegaByte875 MegaByte875 merged commit a657421 into vesoft-inc:master Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing Progress: ready for the CI test type/feature req Type: feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants